//
//  my.h
//  SL
//
//  Created by admin on 16/8/8.
//  Copyright © 2016年 admin. All rights reserved.
//

#ifndef my_h
#define my_h



//取消打印NSLog
#ifdef DEBUG
#define NSLog(...) NSLog(__VA_ARGS__)
#define debugMethod() NSLog(@"%s", __func__)
#else
#define NSLog(...)
#define debugMethod()
#endif

#define KUrl(method)     [NSString stringWithFormat:@"http://sostvcnapi.olive-branch.cn/index.php/api/%@",method]
//http://sostvcnapi.olive-branch.cn/index.php/api/video/playvideo
//必传参数：cate_id

#define MovieCachesAr   @"MOVIECACHEAR"



#define kUserDefaults       [NSUserDefaults standardUserDefaults]

#define KShareString @"KShareString" //分享字符

#define kWidth         [UIScreen mainScreen].bounds.size.width   // 当前屏幕宽
#define kHeight        [UIScreen mainScreen].bounds.size.height  // 当前屏幕高
#define kAppDelegate        (AppDelegate *)[[UIApplication sharedApplication] delegate]
#define kBundleLoadNibName(name) [[[NSBundle mainBundle] loadNibNamed:name owner:nil options:nil] lastObject]
#define is_IOS_7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
/// 常用宏定义

#define kNotificationCenter [NSNotificationCenter defaultCenter]
#define kApplication        [UIApplication sharedApplication]
#define kAppDelegate        (AppDelegate *)[[UIApplication sharedApplication] delegate]
#define kFileManager        [NSFileManager defaultManager]
#define kBundle             [NSBundle mainBundle]
#define kDevice             [UIDevice currentDevice]
#define kWindow             [[UIApplication sharedApplication] keyWindow]
#define kBundleVersion      [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]
#define kDocumentPath       [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]
#define kBundleLoadNibName(name) [[[NSBundle mainBundle] loadNibNamed:name owner:nil options:nil] lastObject]

/// 颜色
#define kBlackColor     [UIColor blackColor]      // 0.0 white
#define kDarkGrayColor  [UIColor darkGrayColor]   // 0.333 white
#define kLightGrayColor [UIColor lightGrayColor]  // 0.667 white
#define kWhiteColor     [UIColor whiteColor]      // 1.0 white
#define kGrayColor      [UIColor grayColor]       // 0.5 white
#define kRedColor       [UIColor redColor]        // 1.0, 0.0, 0.0 RGB
#define kGreenColor     [UIColor greenColor]      // 0.0, 1.0, 0.0 RGB
#define kBlueColor      [UIColor blueColor]       // 0.0, 0.0, 1.0 RGB
#define hCyanColor      [UIColor cyanColor]       // 0.0, 1.0, 1.0 RGB
#define hYellowColor    [UIColor yellowColor]     // 1.0, 1.0, 0.0 RGB
#define hMagentaColor   [UIColor magentaColor]    // 1.0, 0.0, 1.0 RGB
#define kOrangeColor    [UIColor orangeColor]     // 1.0, 0.5, 0.0 RGB
#define kPurpleColor    [UIColor purpleColor]     // 0.5, 0.0, 0.5 RGB
#define hBrownColor     [UIColor brownColor]      // 0.6, 0.4, 0.2 RGB
#define kClearColor     [UIColor clearColor]      // 0.0 white, 0.0 alpha
#define RGBColor0(_f)   [UIColor colorWithRed:((float)((_f & 0xFF0000) >> 16))/255.0 green:((float)((_f & 0xFF00)>> 8))/255.0 blue:((float) (_f & 0xFF))/255.0 alpha:1.0f]
#define RGBColor1(_r, _g, _b)     [UIColor colorWithRed:(_r)/255.0 green:(_g)/255.0 blue:(_b)/255.0 alpha:1.0f]
#define RGBColor2(_r, _g, _b, _a) [UIColor colorWithRed:(_r)/255.0 green:(_g)/255.0 blue:(_b)/255.0 alpha:_a]
#define RandomColor RGBColor1(arc4random_uniform(255), arc4random_uniform(255), arc4random_uniform(255))

/// 常用
#define ImageNamed(_name)     [UIImage imageNamed:_name]
#define URLWithString(str)    [NSURL URLWithString:str]
#define FontSize(_size)       [UIFont systemFontOfSize:_size]
#define HeiTiFont(_size)      [UIFont fontWithName:@"HelveticaNeue" size:_size]
#define CellLineColor         RGBColor0(0xaaaaaa)

#define StringWithInt(num)             [NSString stringWithFormat:@"%d", (num)]
#define NumberWithInt(num)             [NSNumber numberWithInt: (num)]

#define AlignmentLeft   NSTextAlignmentLeft
#define AlignmentCenter NSTextAlignmentCenter
#define AlignmentRight  NSTextAlignmentRight

// 屏幕适配
#define iPhone4 (kHeight == 480)
#define iPhone5 (kHeight == 568)
#define iPhone6 (kHeight == 667)
#define iPhone6p (kHeight == 736)

//提示
#define showAlert(title,mesg)  [[[UIAlertView alloc]initWithTitle:title message:mesg delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil]show]

/**
 返回宽适配倍率

 @param 375.f 屏幕宽度为375.f （UI图给的宽度是多少，这里就应该是多少）
 */
#define multipe 0.5 * (kWidth / 375.f)
/**
 返回高适配倍率
 
 @param 667.f 屏幕宽度为667.f（UI图给的高度是多少，这里就应该是多少）
 */
#define multipeH 0.5 * (kHeight / 667.f)
#define RGB(R, G, B)    [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1.0]
#define TopSpacing 40.0f
#define BottomSpacing 40.0f
#define LeftSpacing 20.0f
#define RightSpacing  20.0f
#define DELAYEXECUTE(delayTime,func) (dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayTime * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{func;}))
#define DistanceFromTopGuiden(view) (view.frame.origin.y + view.frame.size.height)
#define DistanceFromLeftGuiden(view) (view.frame.origin.x + view.frame.size.width)
#define ViewOrigin(view)   (view.frame.origin)
#define ViewSize(view)  (view.frame.size)
#define ScreenSize [UIScreen mainScreen].bounds.size


#define LSYNoteNotification @"LSYNoteNotification"
#define LSYThemeNotification @"LSYThemeNotification"
#define LSYEditingNotification @"LSYEditingNotification"
#define LSYEndEditNotification @"LSYEndEditNotification"

#define MinFontSize 11.0f
#define MaxFontSize 20.0f

#endif 
